﻿using System.Data.EntityClient;
using System.Data.SqlClient;

namespace referrals
{
    internal class Connection
    {
        public static string GetConnStrSql()
        {
            SqlConnectionStringBuilder connectionString = new SqlConnectionStringBuilder();
            {
                //connectionString.DataSource = "MHFVSPSQL01";
                //connectionString.DataSource = "sql2008";
                connectionString.DataSource = "localhost";
                connectionString.InitialCatalog = "referrals";
                connectionString.UserID = "referralsuser";
                connectionString.Password = "Caram3l";
            }

            return connectionString.ConnectionString;
        }

        public static SqlConnection GetConnection()
        {
            string str = "Data Source=.;Initial Catalog = referrals;User Id=referralsuser;Password=Caram3l;";
            //const string str = "Data Source=sql2008;Initial Catalog = referrals;User Id=referralsuser;Password=Caram3l;";
            //const string str = "Data Source=MHFVSPSQL01;Initial Catalog=Referrals;Persist Security Info=True;User ID=referralsuser;Password=Caram3l";
            var con = new SqlConnection(str);
            return con;
        }

        
        public static string GetEntConnStrSql()
        {
            string connectionString = new EntityConnectionStringBuilder
                {
                    Metadata = "res://*",
                    Provider = "System.Data.SqlClient",
                    ProviderConnectionString = new SqlConnectionStringBuilder
                        {
                            InitialCatalog = "referrals",
                            //DataSource = "MHFVSPSQL01",
                            DataSource = "k004456",

                            IntegratedSecurity = false,
                            UserID = "referralsuser", // User ID such as "sa"
                            Password = "Caram3l", // hide the password
                        }.ConnectionString
                }.ConnectionString;

            return connectionString;
        }
    }
}